package com.axxc.jpa.pattendegign.filter;

import com.axxc.jpa.pattendegign.commons.C;

/**
 * @ClassName Person
 * @Description //TODO 请描述该类的作用
 * @author xxc
 * @data 2018年9月8日下午10:49:43
 * @see {@link http://gitee.com/biuabiu/ }
 */
public class Person implements C {

	private static final long serialVersionUID = 1L;

	public Person(String name, Integer gender, Integer maritalStatus) {
		super();
		this.name = name;
		this.gender = gender;
		this.maritalStatus = maritalStatus;
	}

	public Person() {
	}

	private String name;// 姓名
	private Integer gender;// 性别 1=男 0=女性
	private Integer maritalStatus;// 婚姻状态1=单身,2=已婚

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((gender == null) ? 0 : gender.hashCode());
		result = prime * result + ((maritalStatus == null) ? 0 : maritalStatus.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Person other = (Person) obj;
		if (gender == null) {
			if (other.gender != null)
				return false;
		} else if (!gender.equals(other.gender))
			return false;
		if (maritalStatus == null) {
			if (other.maritalStatus != null)
				return false;
		} else if (!maritalStatus.equals(other.maritalStatus))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getGender() {
		return gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	public Integer getMaritalStatus() {
		return maritalStatus;
	}

	public void setMaritalStatus(Integer maritalStatus) {
		this.maritalStatus = maritalStatus;
	}

	@Override
	public void show() {
		System.out.println(String.format("Person:{name=%s,gender=%s,maritalStatus=%s}", name,
				gender == 0 ? "女" : gender == 1 ? "男" : "未知", maritalStatus == 1 ? "未婚" : "已婚"));
	}

}
